package com.example.demo.repository;

import com.example.demo.bean.FileBean;
import com.example.demo.bean.GroupBean;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

/**
 * @author zhangbiao
 * @date 2020/6/25 11:00
 * @desc 描述
 */
public interface GroupRepository extends JpaRepository<GroupBean, String> {

    public void deleteByObjId(String obj_id);

    @Query(value = "SELECT * FROM t_group WHERE user_id = ?1 AND master = 1",
            nativeQuery = true)
    public Map<String, Object> findGroupBeanById(String uid);


    @Query(value = "SELECT  COUNT(*) FROM t_group WHERE group_id = ?1",
            nativeQuery = true)
    public String findCountGroupBeanById(String gid);


    @Query(value = "SELECT * FROM t_group WHERE user_id = ?1",
            nativeQuery = true)
    public List<Map<String, Object>> findisGroupById(String cuserid);

    @Query(value = "SELECT * FROM t_group WHERE master = '1'",
            nativeQuery = true)
    public List<Map<String, Object>> findGroup();
}
